package Offer2017;

/**
 * 二进制数中1的个数
 * Created by 雷文康 on 2017/12/29.
 */
public class Test10 {
    public static void main(String[] args) {
        int result = findNumOf1(-3);
        System.out.println(result);
    }
    public static int findNumOf1(int m){
        int count = 0;
        while (m != 0) {
            count++;
            m = m & (m - 1);
        }
        return count;
    }
}
